define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'bargaining.bargaining/index',
        add_url: 'bargaining.bargaining/add',
        edit_url: 'bargaining.bargaining/edit',
        delete_url: 'bargaining.bargaining/delete',
        export_url: 'bargaining.bargaining/export',
        modify_url: 'bargaining.bargaining/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: '主键'},                    {field: 'image', title: '砍价图片', templet: ea.table.image},                    {field: 'title', title: '砍价名称'},                    {field: 'bottom_price', title: '砍价价格'},                    {field: 'bargain_min_price', title: '最低价'},                    {field: 'number_of_participants', title: '参与人数'},                    {field: 'bargaining_number', title: '帮忙砍价人数'},                    {field: 'successful_number', title: '砍价成功人数'},                    {field: 'limit', title: '限量'},                    {field: 'status', search: 'select', selectList: ["关闭","开启"], title: '砍价状态', templet: ea.table.switch},                    {field: 'create_time', title: '注册时间'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});